package hy.config;

import hy.beans.LoginInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@MapperScan("hy.dao")
@Configuration
public class Mycfg implements WebMvcConfigurer{
    @Override
    public void addViewControllers(ViewControllerRegistry reg) {
        reg.addViewController("/showLogin").setViewName("login");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login","/showLogin");
    }
}
